/*
 * Copyright (c) 2015 YCY Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *
 * $Id: RelationClearTask.java  2015-2-13 下午4:54:48 jackLiang $
 */
package com.jkwzms.other.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jkwzms.system.auth.task.AuthRelationClearTask;
import com.jkwzms.system.group.task.GroupClearRelationTask;
import com.jkwzms.system.permission.task.RoleClearRelationTask;
import com.jkwzms.system.user.task.UserClearRelationTask;

/**
 * 定时清理对象间的关系
 * 
 * @author JackLiang
 * @date 2015-2-17
 * @version 1.0.0
 */
@Service("relationClearTask")
public class RelationClearTask {

    @Autowired
    private UserClearRelationTask  userClearRelationTask;

    @Autowired
    private GroupClearRelationTask groupClearRelationTask;

    @Autowired
    private RoleClearRelationTask  roleClearRelationTask;

    @Autowired
    private AuthRelationClearTask  authRelationClearTask;

    public void autoClearRelation() {

        // 用户与组织机构/工作职务的关系
        userClearRelationTask.clearDeletedUserRelation();

        // 分组与组织机构/工作职务的关系
        groupClearRelationTask.clearDeletedGroupRelation();

        // 角色与资源/权限的关系
        roleClearRelationTask.clearDeletedRoleRelation();

        // 授权与组织机构、组、角色的关系
        authRelationClearTask.clearDeletedAuthRelation();
    }

}
